package com.zelix;

import java.util.BitSet;

public final class sn {

    private wn a[];
    private wn b[];
    private e1 c;
    public static boolean d;
    private static String z[];

    public sn(String s, wn awn[], e1 e1_1) {
        super();

        int j;
        b = awn;
        a = wn.a(1);
        c = e1_1;
        a[0] = wn.c(s);
        for (j = 0; j < b.length; j++) {
            if (b[j] == null) {
                b[j] = wn.m;
            }
        }
    }

    public sn(wn awn[]) {
        this(awn, ((e1) (null)));
    }

    public sn(wn awn[], e1 e1_1) {
        this(wn.a(0), awn, e1_1);
    }

    public sn(wn awn[], wn awn1[]) {
        this(awn, awn1, null);
    }

    public sn(wn awn[], wn awn1[], e1 e1_1) {
        super();
        int j;
        b = awn1;
        a = awn;
        c = e1_1;
        for (j = 0; j < b.length; j++) {
            if (b[j] == null) {
                b[j] = wn.m;
            }
        }
    }

    public boolean a() {
        int j;
        int k;
        j = a.length;
        for (k = 0; k < j; k++) {
            if (!a[k].e())
                return false;
        }
        int l;
        int i1;
        l = b.length;
        for (i1 = 0; i1 < l; i1++) {
            if (!b[i1].e())
                return false;
        }
        return true;
    }

    private static boolean a(wn wn1, wn wn2) {
        if (wn1.equals(wn2))
            return true;
        if (e(wn1) && e(wn2))
            return true;
        if (wn2.b("J"))
            return wn1.b("I") || wn1.b("B") || wn1.b("Z") || wn1.b("C") || wn1.b("S");
        if (wn2.b("F"))
            return wn1.b("I");
        if (wn2.b("D"))
            return wn1.b("F") || wn1.b("I");
        return i(wn1) && i(wn2);
    }

    public wn[] c() {
        return a;
    }

    tn d() {
        return new tn(this);
    }

    public e1 e() {
        return c;
    }

    public wn[] f() {
        return b;
    }

    private boolean a(um um1, sn sn1)
            throws tb {
        int j;
        wn awn[];
        int k;

        j = b.length;
        awn = sn1.b;
        if (j == awn.length) {
            for (k = 0; k < j; k++) {
                if ((!b[k].equals(awn[k])) && (!awn[k].b("?"))) {
                    if (b[k].b("?"))
                        return false;
                    if (i(b[k]) && i(awn[k])) {
                        if (awn[k].b("n"))
                            return false;
                        if (b[k].b("n"))
                            return false;
                        if (!um1.a(b[k], awn[k]))
                            return false;
                    } else {
                        return false;
                    }
                }
            }
            return true;
        } else {
            throw new tb(z[2] + j + " " + awn.length);
        }
    }

    public static boolean a(wn wn1, wn wn2, um um1)
            throws wb {
        if (i(wn1) && i(wn2)) {
            if (wn1.b("n"))
                return true;
            if (um1.a(wn1, wn2))
                return true;
            else
                return um1.a(wn2);
        } else {
            return a(wn1, wn2);
        }
    }

    public static boolean c(wn wn1) {
        return wn1.b("J") || wn1.b("D");
    }

    public boolean b(um um1, sn sn1)
            throws tb {
        return c(um1, sn1) && a(um1, sn1);
    }

    public static boolean e(wn wn1) {
        return wn1.b("I");
    }

    public static boolean g(wn wn1) {
        return wn1 == null || wn1.b("?");
    }

    public static boolean i(wn wn1) {
        return wn1.e("[") || wn1.e("L") && wn1.a(";") || wn1.b("n");
    }

    private boolean c(um um1, sn sn1)
            throws wb {
        int j;
        int k;
        j = a.length;
        if (j == sn1.g()) {
            for (k = 0; k < j; k++) {
                if (!a[k].equals(sn1.a[k]))
                    if (i(a[k]) && i(sn1.a[k])) {
                        if (a[k].b("n"))
                            return false;
                        if (sn1.a[k].b("n"))
                            return false;
                        if (!um1.a(a[k], sn1.a[k]))
                            return false;
                    } else {
                        return false;
                    }
            }
            return true;
        }
        return false;
    }

    public sn a(um um1, sn sn1, fv fv1)
            throws tb, sb {
        sn sn2;
        label0:
        {
            fv fv2 = new fv();
            fv fv3 = new fv();
            wn awn[] = a(um1, a, sn1.a, true, fv2);
            wn awn1[] = b(um1, b, sn1.b, true, fv3);
            fv1.a(fv2.a() || fv3.a());
            if (c != null && sn1.c != null) {
                if (c.equals(sn1.c)) {
                    sn2 = new sn(awn, awn1, (e1) c.clone());
                } else {
                    e1 e1_1 = (e1) c.clone();
                    e1_1.or(sn1.c);
                    sn2 = new sn(awn, awn1, e1_1);
                    fv1.a(true);
                }
            } else {
                sn2 = new sn(awn, awn1);
            }
        }
        return sn2;
    }

    private static wn[] a(um um1, wn awn[], wn awn1[], boolean flag, fv fv1)
            throws tb, sb {
        int j;
        wn awn2[];
        int k;
        boolean flag1;
        label0:
        {
            fv1.a(false);
            if (awn.length != awn1.length)
                throw new sb(z[0] + awn.length + " " + awn1.length);
            j = awn.length;
            if (flag) {
                awn2 = (wn[]) awn.clone();
            } else {
                awn2 = awn;
            }
        }
        for (k = 0; k < j; k++) {
            if (awn1[k].equals(awn2[k]))
                continue;
            fv1.a(true);
            if (i(awn1[k]) && i(awn2[k])) {
                if (awn2[k].b("n")) {
                    awn2[k] = awn1[k];
                } else if (awn1[k].b("n"))
                    continue;
                awn2[k] = wn.c(um1.b(awn1[k], awn2[k]));
            } else {
                throw new sb(z[1] + awn2[k].d() + " " + awn1[k].d());
            }
        }
        return awn2;
    }

    private static wn[] a(um um1, wn awn[], wn awn1[], e1 e1_1, fv fv1)
            throws wb {
        int j;
        wn awn2[];
        j = awn.length;
        awn2 = (wn[]) awn.clone();
        fv1.a(false);
        if (e1_1 != null) {
            for (int k = 0; k < j; k++) {
                if (!awn1[k].equals(awn2[k]) && e1_1.get(k)) {
                    fv1.a(true);
                    awn2[k] = awn1[k];
                }
            }

        }
        return awn2;
    }

    private static wn[] b(um um1, wn awn[], wn awn1[], boolean flag, fv fv1)
            throws wb {
        int j;
        wn awn2[];
        int k;
        boolean flag1;
        label0:
        {
            j = awn.length;
            if (flag) {
                awn2 = (wn[]) awn.clone();
            } else {
                awn2 = awn;
            }
        }
        fv1.a(false);
        for (k = 0; k < j; k++) {
            if (awn1[k].equals(awn2[k])) {
                if (!awn2[k].b("~") || awn2[k - 1].equals(wn.j) || awn2[k - 1].equals(wn.l))
                    continue;
                awn2[k] = wn.m;
            } else {
                fv1.a(true);
                if (awn1[k].b("?") || awn2[k].b("?")) {
                    awn2[k] = wn.m;
                } else if (i(awn1[k]) && i(awn2[k])) {
                    if (awn2[k].b("n")) {
                        awn2[k] = awn1[k];
                    } else if (awn1[k].b("n"))
                        continue;
                    awn2[k] = wn.c(um1.b(awn1[k], awn2[k]));
                } else {
                    awn2[k] = wn.m;
                }
            }
        }
        return awn2;
    }

    public final int g() {
        return a.length;
    }

    public static sn a(um um1, sn sn1, wn awn[], e1 e1_1)
            throws tb, sb {
        sn sn2;
        fv fv1 = new fv();
        wn awn1[] = a(um1, awn, sn1.b, sn1.c, fv1);
        if (e1_1 != null) {
            if (sn1.c.equals(e1_1)) {
                sn2 = new sn(sn1.a, awn1, e1_1);
            } else {
                e1 e1_2 = (e1) e1_1.clone();
                e1_2.or(sn1.c);
                sn2 = new sn(sn1.a, awn1, e1_2);
            }
        } else {
            sn2 = new sn(sn1.a, awn1);
        }
        return sn2;
    }

    private static String z(char[] chs) {
        for (int i = 0; i < chs.length; i++) {
            byte key = 0;
            switch (i % 5) {
                case 0:
                    key = 0x2b;
                    break;
                case 1:
                    key = 50;
                    break;
                case 2:
                    key = 46;
                    break;
                case 3:
                    key = 57;
                    break;
                default:
                    key = 115;
                    break;
            }
            chs[i] ^= key;
        }
        return new String(chs).intern();
    }

    static {
        String as[];
        as = new String[3];
        as[0] = "b\\MV\035X[]M\026EF\016J\007JQE\031\033N[IQ\007X\022";
        as[1] = "xFOZ\030\013_GJ\036JFMQS\\[ZQS_K^\\\000\021\022";
        as[2] = "f[]T\022_QF\\\027\013^AZ\022G\022XX\001BSLU\026\013QAL\035_A\024\031";
        for (int i = 0; i < as.length; i++) {
            as[i] = z(as[i].toCharArray());
        }
        z = as;

    }
}